package com.ruoyi.zhjd.laboratory.modules.asphaltPenetrometer.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.zhjd.laboratory.modules.asphaltPenetrometer.entity.AsphaltPenetrometerResEntity;
import com.ruoyi.zhjd.laboratory.modules.asphaltPenetrometer.service.AsphaltPenetrometerResService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;

/**
 * 沥青针入度仪_结果表
 *
 * @author sx
 * @email
 * @date 2023-07-11 17:18:05
 */
@RestController
@RequestMapping("laboratory/asphaltPenetrometerRes")
public class AsphaltPenetrometerResController {

    @Autowired
    private AsphaltPenetrometerResService asphaltPenetrometerResService;

    /**
     * 列表
     */
    @RequestMapping("/page")
    //
    public R page(@RequestParam Map<String, Object> params){
        IPage page = asphaltPenetrometerResService.queryPage(params);
        return R.ok(page);
    }


    /**
     * 信息
     */
    @RequestMapping("/find/{id}")
    //
    public R find(@PathVariable("id") String id){
		AsphaltPenetrometerResEntity asphaltPenetrometerRes = asphaltPenetrometerResService.getInfo(id);
        return R.ok(asphaltPenetrometerRes);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //
    public R save(@RequestBody AsphaltPenetrometerResEntity asphaltPenetrometerRes){
		asphaltPenetrometerResService.saveData(asphaltPenetrometerRes);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //
    public R update(@RequestBody AsphaltPenetrometerResEntity asphaltPenetrometerRes){
        asphaltPenetrometerResService.updateData(asphaltPenetrometerRes);
        return R.ok();
    }


    /**
     * 删除单个
     */
    @RequestMapping("/delete/{id}")
    //
    public R deleteOne(@PathVariable("id") String id){
        asphaltPenetrometerResService.deleteOneData(id);
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //
    public R delete(@RequestBody String[] ids){
        asphaltPenetrometerResService.deleteData(Arrays.asList(ids));
        return R.ok();
    }
}
